<?
    // // 1.连接数据库   mysqli_connect  四个参数：  本机ip，连接外部数据库名，数据库密码，数据库的具体名称 
    $link1 = mysqli_connect("localhost","root","root","stu_info");
    // var_dump($link1);
    $arr1 = $_GET;
    if( $arr1['op'] == 'add' ){
        $sqlOp = "INSERT INTO stu (stuName,gender,age,score) VALUES ('{$arr1["username"]}','{$arr1["gender"]}',{$arr1['age']},{$arr1['score']})";
    }
    // var_dump($arr1['op'] == 'del') ;
    if( $arr1['op'] == 'del' ){
        $sqlOp = "DELETE FROM stu WHERE id = {$arr1['id']}";
    }
    // echo $sqlOp ; 
    // exit;
    $res1 = mysqli_query($link1,$sqlOp);
    if( $res1 ){
        echo "操作成功";
    } else {
        echo "操作失败";
    }
    header("Location:./stu.php"); 
?>